import unittest
from pygo1963.model.OpeningKnowledge import OpeningKnowledge
from pygo1963.model.Constants import WHITE_COLOR, BLACK_COLOR
from pygo1963.model.Board import Board
from pygo1963.model.Move import Move
from pygo1963.model.Vertex import Vertex

class OpeningKnowledgeTest(unittest.TestCase):

    def setUp(self):
        self.board = Board(6)

    def testFirstMove(self):
       
        openingKnowledge = OpeningKnowledge(WHITE_COLOR)
        
        move = openingKnowledge.get_opening_move(self.board)
        
        self.assertTrue(move)

        self.assertEqual(move, Move(WHITE_COLOR, Vertex.from_string("c3")))
        
    def testSecondMove(self):
        
        self.board.make_move(Move(BLACK_COLOR, Vertex.from_string("c3")))
        
        openingKnowledge = OpeningKnowledge(WHITE_COLOR)
        
        move = openingKnowledge.get_opening_move(self.board)
        
        self.assertTrue(move)

if __name__ == "__main__":
    unittest.main()